//
//  TDQuickQukuanViewController.m
//  TFB
//
//  Created by yull on 15/10/17.
//  Copyright (c) 2015年 TD. All rights reserved.
//

#import "TDQuickQukuanViewController.h"

@interface TDQuickQukuanViewController () <UIWebViewDelegate>

@end

@implementation TDQuickQukuanViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.navigationItem.title = @"快速提款";
    self.edgesForExtendedLayout = UIRectEdgeNone;
    self.view.backgroundColor = [UIColor whiteColor];
    [self setupCustomBackItem];
    
    [MBProgressHUD showHUDAddedTo:self.view animated:YES];
    [TDHttpEngine requestFor_QUICK_WITHDRAW_WithCustId:[[NSUserDefaults standardUserDefaults] objectForKey:CUST_ID] custMobile:[[NSUserDefaults standardUserDefaults] objectForKey:CUST_MOBILE] complete:^(BOOL succeed, NSString *msg, id reqBody) {
        [MBProgressHUD hideAllHUDsForView:self.view animated:YES];
        if (succeed) {
            NSString *url = [reqBody objectForKey:@"url"];
            if ([url isKindOfClass:[NSString class]] && url.length) {
                UIWebView *webView = [[UIWebView alloc] initWithFrame:self.view.bounds];
                webView.delegate = self;
                webView.autoresizingMask = self.view.autoresizingMask;
                [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]];
                [self.view addSubview:webView];
            }
        } else {
            [self.view makeToast:msg duration:2.0f position:@"center"];
        }
    }];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

- (void)webViewDidFinishLoad:(UIWebView *)webView {
    
    [webView stringByEvaluatingJavaScriptFromString:@"javascript:$(\".header\").hide();$(\".more\").hide()"];
}

@end
